package com.hsnn.medstgmini.sys.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.springframework.format.annotation.DateTimeFormat;

import com.hsnn.medstgmini.base.dict.model.DicArea;
import com.hsnn.medstgmini.base.dict.model.DicHosptype;
import com.hsnn.medstgmini.base.std.model.HospClassify;
import com.hsnn.medstgmini.base.std.model.HospLevel;
import com.hsnn.medstgmini.util.DateUtil;
import com.hsnn.medstgmini.util.PinYin;

/**
 * @category 医疗机构库
 * @author CCL
 */
@Entity
@Table(name = "reg_hospinfo")
public class RegHospInfo implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "hosp_id")
	private String hospId;

	@Column(name = "hosp_code")
	private String hospCode;

	@Column(name = "hosp_name")
	private String hospName;

	@Column(name = "hosp_spel_code")
	private String hospSpelCode;

	@Column(name = "hosp_short_name")
	private String hospShortName;

	@Column(name = "hosp_short_spel_code")
	private String hospShortSpelSode;

	@Column(name = "org_code")
	private String orgCode;

	@Column(name = "hosp_classify")
	private Integer hospClassify;

	@Transient
	private String hospClassifyName;

	@Column(name = "hosp_level_id")
	private String hospLevelId;

	@Transient
	private String hospLevelName;

	@Transient
	private String hsopLevelName;

	@Column(name = "hosp_address")
	private String hospAddress;

	@Column(name = "hosp_phone")
	private String hospPhone;

	@OneToOne
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "area_id", referencedColumnName = "area_id")
	private DicArea area;

	@Column(name = "bed_num")
	private Integer bedNum;

	@Column(name = "incom_pat_num")
	private BigDecimal incomPatNum;

	@Column(name = "staff_num")
	private Integer staffNum;

	@Column(name = "reg_cap")
	private BigDecimal regCap;

	@Column(name = "profile")
	private String profile;

	@Column(name = "legal_rep_name")
	private String legalRepName;

	@Column(name = "legal_rep_idnum")
	private String legalRepIdnum;

	@Column(name = "legal_rep_telephone")
	private String legalRepTelephone;

	@Column(name = "legal_rep_handphone")
	private String legalRepHandphone;

	@Column(name = "contact_name")
	private String contactName;

	@Column(name = "contact_idnum")
	private String contactIdnum;

	@Column(name = "contact_pos")
	private String contactPos;

	@Column(name = "contact_telephone")
	private String contactTelephone;

	@Column(name = "contact_handphone")
	private String contactHandphone;

	@Column(name = "contact_email")
	private String contactEmail;

	@Column(name = "contact_qq")
	private String contactQQ;

	@Column(name = "hosp_lice_no")
	private String hospLiceNo;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "hosp_lice_start_date")
	private Date hospLiceStartDate;

	@Transient
	private String hospLiceStartDateStr;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "hosp_lice_end_date")
	private Date hospLiceEndDate;

	@Transient
	private String hospLiceEndDateStr;

	@Column(name = "enter_lice_no")
	private String enterLiceNo;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "enter_lice_start_date")
	private Date enterLiceStartDate;

	@Transient
	private String enterLiceStartDateStr;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "enter_lice_end_date")
	private Date enterLiceEndDate;

	@Transient
	private String enterLiceEndDateStr;

	@Column(name = "reg_datetime")
	private Date regDateTime;

	@Column(name = "audit_status")
	private Integer auditStatus;

	@Transient
	private String auditStatusName;

	@Column(name = "auditor")
	private String auditor;

	@Column(name = "audit_datetime")
	private Date auditDateTime;

	@Column(name = "audit_remark")
	private String auditRemark;

	@OneToOne
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "hosp_type_id", referencedColumnName = "hosp_type_id")
	private DicHosptype hosptype;

	public String getHospId() {
		return hospId;
	}

	public void setHospId(String hospId) {
		this.hospId = hospId;
	}

	public String getHospCode() {
		return hospCode;
	}

	public void setHospCode(String hospCode) {
		this.hospCode = hospCode;
	}

	public String getHospName() {
		return hospName;
	}

	public void setHospName(String hospName) {
		if (hospName != null && !"".equals(hospName)) {
			hospSpelCode = PinYin.getPinYinHeadChar(hospName);
		}
		this.hospName = hospName;
	}

	public String getHospSpelCode() {
		return hospSpelCode;
	}

	public void setHospSpelCode(String hospSpelCode) {
		this.hospSpelCode = hospSpelCode;
	}

	public String getHospShortName() {
		return hospShortName;
	}

	public void setHospShortName(String hospShortName) {
		if (hospShortName != null && !"".equals(hospShortName)) {
			hospShortSpelSode = PinYin.getPinYinHeadChar(hospShortName);
		}
		this.hospShortName = hospShortName;
	}

	public String getHospShortSpelSode() {
		return hospShortSpelSode;
	}

	public void setHospShortSpelSode(String hospShortSpelSode) {
		this.hospShortSpelSode = hospShortSpelSode;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public Integer getHospClassify() {
		return hospClassify;
	}

	public void setHospClassify(Integer hospClassify) {
		this.hospClassify = hospClassify;
	}

	public String getHospLevelId() {
		return hospLevelId;
	}

	public void setHospLevelId(String hospLevelId) {
		this.hospLevelId = hospLevelId;
	}

	public String getHospAddress() {
		return hospAddress;
	}

	public void setHospAddress(String hospAddress) {
		this.hospAddress = hospAddress;
	}

	public String getHospPhone() {
		return hospPhone;
	}

	public void setHospPhone(String hospPhone) {
		this.hospPhone = hospPhone;
	}

	public DicArea getArea() {
		return area;
	}

	public void setArea(DicArea area) {
		this.area = area;
	}

	public DicHosptype getHosptype() {
		return hosptype;
	}

	public void setHosptype(DicHosptype hosptype) {
		this.hosptype = hosptype;
	}

	public String getHsopLevelName() {
		if (hospLevelId != null) {
			hsopLevelName = HospLevel.getName(hospLevelId);
		}
		return hsopLevelName;
	}

	public void setHsopLevelName(String hsopLevelName) {
		this.hsopLevelName = hsopLevelName;
	}

	public String getHospClassifyName() {
		if (hospClassify != null) {
			hospClassifyName = HospClassify.getName(hospClassify);
		}
		return hospClassifyName;
	}

	public void setHospClassifyName(String hospClassifyName) {
		this.hospClassifyName = hospClassifyName;
	}

	public String getHospLevelName() {
		if (hospLevelId != null) {
			hospLevelName = HospLevel.getName(hospLevelId);
		}
		return hospLevelName;
	}

	public void setHospLevelName(String hospLevelName) {
		this.hospLevelName = hospLevelName;
	}

	public Integer getBedNum() {
		return bedNum;
	}

	public void setBedNum(Integer bedNum) {
		this.bedNum = bedNum;
	}

	public BigDecimal getIncomPatNum() {
		return incomPatNum;
	}

	public void setIncomPatNum(BigDecimal incomPatNum) {
		this.incomPatNum = incomPatNum;
	}

	public Integer getStaffNum() {
		return staffNum;
	}

	public void setStaffNum(Integer staffNum) {
		this.staffNum = staffNum;
	}

	public BigDecimal getRegCap() {
		return regCap;
	}

	public void setRegCap(BigDecimal regCap) {
		this.regCap = regCap;
	}

	public String getProfile() {
		return profile;
	}

	public void setProfile(String profile) {
		this.profile = profile;
	}

	public String getLegalRepName() {
		return legalRepName;
	}

	public void setLegalRepName(String legalRepName) {
		this.legalRepName = legalRepName;
	}

	public String getLegalRepIdnum() {
		return legalRepIdnum;
	}

	public void setLegalRepIdnum(String legalRepIdnum) {
		this.legalRepIdnum = legalRepIdnum;
	}

	public String getLegalRepTelephone() {
		return legalRepTelephone;
	}

	public void setLegalRepTelephone(String legalRepTelephone) {
		this.legalRepTelephone = legalRepTelephone;
	}

	public String getLegalRepHandphone() {
		return legalRepHandphone;
	}

	public void setLegalRepHandphone(String legalRepHandphone) {
		this.legalRepHandphone = legalRepHandphone;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public String getContactIdnum() {
		return contactIdnum;
	}

	public void setContactIdnum(String contactIdnum) {
		this.contactIdnum = contactIdnum;
	}

	public String getContactPos() {
		return contactPos;
	}

	public void setContactPos(String contactPos) {
		this.contactPos = contactPos;
	}

	public String getContactTelephone() {
		return contactTelephone;
	}

	public void setContactTelephone(String contactTelephone) {
		this.contactTelephone = contactTelephone;
	}

	public String getContactHandphone() {
		return contactHandphone;
	}

	public void setContactHandphone(String contactHandphone) {
		this.contactHandphone = contactHandphone;
	}

	public String getContactEmail() {
		return contactEmail;
	}

	public void setContactEmail(String contactEmail) {
		this.contactEmail = contactEmail;
	}

	public String getContactQQ() {
		return contactQQ;
	}

	public void setContactQQ(String contactQQ) {
		this.contactQQ = contactQQ;
	}

	public String getHospLiceNo() {
		return hospLiceNo;
	}

	public void setHospLiceNo(String hospLiceNo) {
		this.hospLiceNo = hospLiceNo;
	}

	public Date getHospLiceStartDate() {
		return hospLiceStartDate;
	}

	public void setHospLiceStartDate(Date hospLiceStartDate) {
		this.hospLiceStartDate = hospLiceStartDate;
	}

	public Date getHospLiceEndDate() {
		return hospLiceEndDate;
	}

	public void setHospLiceEndDate(Date hospLiceEndDate) {
		this.hospLiceEndDate = hospLiceEndDate;
	}

	public String getEnterLiceNo() {
		return enterLiceNo;
	}

	public void setEnterLiceNo(String enterLiceNo) {
		this.enterLiceNo = enterLiceNo;
	}

	public Date getEnterLiceStartDate() {
		return enterLiceStartDate;
	}

	public void setEnterLiceStartDate(Date enterLiceStartDate) {
		this.enterLiceStartDate = enterLiceStartDate;
	}

	public Date getEnterLiceEndDate() {
		return enterLiceEndDate;
	}

	public void setEnterLiceEndDate(Date enterLiceEndDate) {
		this.enterLiceEndDate = enterLiceEndDate;
	}

	public String getHospLiceStartDateStr() {
		if (hospLiceStartDate != null) {
			hospLiceStartDateStr = DateUtil.date(hospLiceStartDate);
		}
		return hospLiceStartDateStr;
	}

	public void setHospLiceStartDateStr(String hospLiceStartDateStr) {
		this.hospLiceStartDateStr = hospLiceStartDateStr;
	}

	public String getHospLiceEndDateStr() {
		if (hospLiceEndDate != null) {
			hospLiceEndDateStr = DateUtil.date(hospLiceEndDate);
		}
		return hospLiceEndDateStr;
	}

	public void setHospLiceEndDateStr(String hospLiceEndDateStr) {
		this.hospLiceEndDateStr = hospLiceEndDateStr;
	}

	public String getEnterLiceStartDateStr() {
		if (enterLiceStartDate != null) {
			enterLiceStartDateStr = DateUtil.date(enterLiceStartDate);
		}
		return enterLiceStartDateStr;
	}

	public void setEnterLiceStartDateStr(String enterLiceStartDateStr) {
		this.enterLiceStartDateStr = enterLiceStartDateStr;
	}

	public String getEnterLiceEndDateStr() {
		if (enterLiceEndDate != null) {
			enterLiceEndDateStr = DateUtil.date(enterLiceEndDate);
		}
		return enterLiceEndDateStr;
	}

	public void setEnterLiceEndDateStr(String enterLiceEndDateStr) {
		this.enterLiceEndDateStr = enterLiceEndDateStr;
	}

	public Date getRegDateTime() {
		return regDateTime;
	}

	public void setRegDateTime(Date regDateTime) {
		this.regDateTime = regDateTime;
	}

	public Integer getAuditStatus() {
		return auditStatus;
	}

	public void setAuditStatus(Integer auditStatus) {
		this.auditStatus = auditStatus;
	}

	public String getAuditStatusName() {
		if (auditStatus != null) {
			auditStatusName = AuditType.getName(auditStatus);
		}
		return auditStatusName;
	}

	public void setAuditStatusName(String auditStatusName) {
		this.auditStatusName = auditStatusName;
	}

	public String getAuditor() {
		return auditor;
	}

	public void setAuditor(String auditor) {
		this.auditor = auditor;
	}

	public Date getAuditDateTime() {
		return auditDateTime;
	}

	public void setAuditDateTime(Date auditDateTime) {
		this.auditDateTime = auditDateTime;
	}

	public String getAuditRemark() {
		return auditRemark;
	}

	public void setAuditRemark(String auditRemark) {
		this.auditRemark = auditRemark;
	}

}
